import {
	defineStore
} from 'pinia'
import {
	userActivityDetailAPI,
	applyActiveListAPI,
	getOneCommentListAPI,
	getMoreCommentListAPI,
	commentActivityAPI,
	likeCommentAPI,
	cancelLikeCommentAPI,
	cancelLikeAPI,
	likeAPI,
	favoriteActivityAPI,
	cancelFavoriteActivityAPI,
	tippingActivityAPI,
	SignCodeAPI,
	refuseApplyAPI,
	trueCancelActiveAPI,
	createActiveAPI,
	selectedActiveAPI,
	homeActivityListAPI,
	homeActiveDetailAPI,
	getSearchListAPI,
	applyActiveAPI,
	getApplyActivityUserInfoAPI,
	trueCancelApplyAPI,
	signActivityAPI,
	joinActivityListAPI,
	addTaskAPI,
	getTaskDetailAPI,
	payUserContactListAPI,
	getPayContactStateAPI,
	payGetContactAPI,
	updateTaskStatusAPI,
	refreshTaskAPI,
	likeTaskAPI,
	cancelLikeTaskAPI,
	cancelFavoriteTaskAPI,
	favoriteTaskAPI,
	getTaskListAPI,
	getHomeTaskListAPI,
	getBannerListAPI,
	deleteActivityAPI,
	tippingTaskAPI,
	messageTippingAPI,
	getTaskOneCommentListAPI,
	getTaskMoreCommentListAPI,
	commentTaskAPI,
	likeTaskCommentAPI,
	cancelLikeTaskCommentAPI,
	getUserActivitySignQrcode,
	signActivityByPoster,
	getTaskList
} from '@/api/active.js'
export const useActiveStore = defineStore('active', {
	state: () => {
		return {

		}
	},
	getters: {},
	actions: {
		// 获取获取任务列表（找伴tab）
		async getTaskList(data) {
			let res = await getTaskList(data)
			return res
		},
		// 获取活动详情（发布/参加的活动）
		async getUserActivityDetail(data,token) {
			let res = await userActivityDetailAPI(data,token)
			return res
		},
		// 获取参加活动的报名列表（发布者）（用户）
		async getApplyActiveList(data) {
			let res = await applyActiveListAPI(data)
			return res
		},
		// 获取1级深度评论
		async getOneCommentList(data) {
			let res = await getOneCommentListAPI(data)
			return res
		},
		// 获取更多评论
		async getMoreCommentList(data) {
			let res = await getMoreCommentListAPI(data)
			return res
		},
		// 评论任务、回复评论
		async commentActivity(data) {
			let res = await commentActivityAPI(data)
			return res
		},
		// 点赞
		async likeComment(data) {
			let res = await likeCommentAPI(data)
			return res
		},
		// 取消点赞
		async cancelLikeComment(data) {
			let res = await cancelLikeCommentAPI(data)
			return res
		},
		// 取消喜欢
		async cancelLike(data) {
			let res = await cancelLikeAPI(data)
			return res
		},
		// 添加喜欢
		async addLike(data) {
			let res = await likeAPI(data)
			return res
		},
		// 取消收藏
		async cancelFavoriteActivity(data) {
			let res = await cancelFavoriteActivityAPI(data)
			return res
		},
		// 添加收藏
		async favoriteActivity(data) {
			let res = await favoriteActivityAPI(data)
			return res
		},
		// 打赏星光
		async tippingActivity(data) {
			let res = await tippingActivityAPI(data)
			return res
		},
		// 查看签到码（发布者）
		async SignCode(data) {
			let res = await SignCodeAPI(data)
			return res
		},
		// 拒绝用户报名
		async refuseApply(data) {
			let res = await refuseApplyAPI(data)
			return res
		},
		// 取消活动（发布者）
		async trueCancelActive(data) {
			let res = await trueCancelActiveAPI(data)
			return res
		},
		// 创建组局活动
		async createActive(data) {
			let res = await createActiveAPI(data)
			return res
		},
		// 获取首页精选活动
		async selectedActiveList(data) {
			let res = await selectedActiveAPI(data)
			return res
		},
		// 首页-组局活动
		async getHomeActivityList(data) {
			let res = await homeActivityListAPI(data)
			return res
		},
		// 获取活动详情（首页-精选活动、首页-搜索、首页-组局活动）
		async homeActiveDetail(data,token) {
			let res = await homeActiveDetailAPI(data,token)
			return res
		},
		// 获取搜索列表
		async getSearchList(data) {
			let res = await getSearchListAPI(data)
			return res
		},
		// 报名活动
		async applyActive(data) {
			let res = await applyActiveAPI(data)
			return res
		},
		// 获取单个用户报名参加活动的信息
		async getApplyActivityUserInfo(data) {
			let res = await getApplyActivityUserInfoAPI(data)
			return res
		},
		// 取消报名
		async trueCancelApply(data) {
			let res = await trueCancelApplyAPI(data)
			return res
		},
		// 签到
		async signActivity(data) {
			let res = await signActivityAPI(data)
			return res
		},
		// 发布者确认签到
		async signActivityByPoster(data) {
			let res = await signActivityByPoster(data)
			return res
		},
		// 获取创建任务时的关联活动
		async joinActivityList(data) {
			let res = await joinActivityListAPI(data)
			return res
		},
		// 创建找伴任务
		async addTask(data) {
			let res = await addTaskAPI(data)
			return res
		},
		// 获取任务详情（找伴tab、用户的收藏、用户的发布、首页-搜索、首页-找伴任务）
		async getTaskDetail(data,token) {
			let res = await getTaskDetailAPI(data,token)
			return res
		},
		// 获取用户联系方式列表（购买）
		async payUserContactList(data) {
			let res = await payUserContactListAPI(data)
			return res
		},
		//获取用户联系方式（查询）
		async getPayContactState(data) {
			let res = await getPayContactStateAPI(data)
			return res
		},
		// 购买联系方式
		async payGetContact(data) {
			let res = await payGetContactAPI(data)
			return res
		},
		// 任务上下架
		async updateTaskStatus(data) {
			let res = await updateTaskStatusAPI(data)
			return res
		},
		// 刷新任务
		async refreshTask(data) {
			let res = await refreshTaskAPI(data)
			return res
		},
		// 添加喜欢任务
		async likeTask(data) {
			let res = await likeTaskAPI(data)
			return res
		},
		// 取消喜欢任务
		async cancelLikeTask(data) {
			let res = await cancelLikeTaskAPI(data)
			return res
		},
		// 收藏任务
		async favoriteTask(data) {
			let res = await favoriteTaskAPI(data)
			return res
		},
		// 取消任务
		async cancelFavoriteTask(data) {
			let res = await cancelFavoriteTaskAPI(data)
			return res
		},
		// 获取任务列表（找伴tab）
		async getTaskList(data) {
			let res = await getTaskListAPI(data)
			return res
		},
		// 获取首页任务列表
		async getHomeTaskList(data) {
			let res = await getHomeTaskListAPI(data)
			return res
		},
		// 获取banner图
		async getBannerList(data) {
			let res = await getBannerListAPI(data)
			return res
		},
		// 删除已取消的活动（发布者）
		async deleteActivity(data) {
			let res = await deleteActivityAPI(data)
			return res
		},
		// 打赏任务星光
		async tippingTask(data) {
			let res = await tippingTaskAPI(data)
			return res
		},
		// 打赏消息星光
		async messageTipping(data) {
			let res = await messageTippingAPI(data)
			return res
		},
		// 获取1级深度评论(任务)
		async getTaskOneCommentList(data) {
			let res = await getTaskOneCommentListAPI(data)
			return res
		},
		// 获取更多评论(任务)
		async getTaskMoreCommentList(data) {
			let res = await getTaskMoreCommentListAPI(data)
			return res
		},
		// 评论任务、回复评论(任务)
		async commentTask(data) {
			let res = await commentTaskAPI(data)
			return res
		},
		// 点赞(任务)
		async likeTaskComment(data) {
			let res = await likeTaskCommentAPI(data)
			return res
		},
		// 取消点赞(任务)
		async cancelLikeTaskComment(data) {
			let res = await cancelLikeTaskCommentAPI(data)
			return res
		},
		// 生成二维码
		async getUserActivityQrcode(data) {
			let res = await getUserActivitySignQrcode(data)
			return res
		},
	},
	// 开启数据持久化
	persist: {
		enabled: true
	},
})